package session

import (
	"context"
	"net/http"
)

//var(
//	// ErrKeyNotFound sentinel error 预定义错误
//	ErrKeyNotFound=errors.New("")
//)

// 管理session本身
type Store interface {
	// Session对应的id谁来指定 ? 要不要让session内部生成id
	// 要不要在接口维度上设置超时时间
	Generate(ctx context.Context, id string) (Session, error)
	Refresh(ctx context.Context, id string) error
	Remove(ctx context.Context, id string) error
	Get(ctx context.Context, id string) (Session, error)
}

type Session interface {
	Get(ctx context.Context, key string) (any, error)
	Set(ctx context.Context, key string, val string) error
	ID() string
}

type Propagator interface {
	Inject(id string, writer http.ResponseWriter) error
	Extract(req *http.Request) (string, error)
	Remove(writer http.ResponseWriter) error
}
